/*
    kOTF Open Trace Format - a library for generating execution traces.
    Copyright 2012 Daniel K. O.

    kOTF is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    kOTF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with kOTF.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <kotf/Error.hpp>

namespace kotf {

    Error::Error(const string& m) : msg(m)
    {}
    
    const string&
    Error::what() const throw()
    {
        return msg;
    }



    InvalidIdError::InvalidIdError(const string& w, uint64_t id) :
        Error(w + " " + std::to_string(id) + " does not exist")
    {}

    InvalidStateId::InvalidStateId(uint64_t id) :
        InvalidIdError("state", id)
    {}

    InvalidCounterId::InvalidCounterId(uint64_t id) :
        InvalidIdError("counter", id)
    {}

    InvalidChannelId::InvalidChannelId(uint64_t id) :
        InvalidIdError("channel", id)
    {}



    InvalidSession::InvalidSession(const string& m) :
        Error(m)
    {}

    UnknownRecord::UnknownRecord(const string& m) :
        InvalidSession(m)
    {}

    InvalidStream::InvalidStream(const string& m) :
        Error(m)
    {}


    OpenError::OpenError(const string& m)
        : Error(m)
    {}

    MmapError::MmapError(const string& m) :
        Error(m)
    {}

}


